<template>
  <el-row :gutter="16">
    <el-col :span="6">
      <div class="statistic-card">
        <el-statistic v-loading="loading" :value="data.todayNum">
          <template #title>
            <div style="display: inline-flex; align-items: center">
             今日发票数量
            </div>
          </template>
        </el-statistic>
      </div>
    </el-col>
    <el-col :span="6">
      <div class="statistic-card">
        <el-statistic v-loading="loading" :value="data.todayTotal">
          <template #title>
            <div style="display: inline-flex; align-items: center">
              今日发票金额
            </div>
          </template>
        </el-statistic>
      </div>
    </el-col>
    <el-col :span="6">
      <div class="statistic-card">
        <el-statistic v-loading="loading" :value="data.yesterdayNum">
          <template #title>
            <div style="display: inline-flex; align-items: center">
              昨日发票数量
            </div>
          </template>
        </el-statistic>
      </div>
    </el-col>
    <el-col :span="6">
      <div class="statistic-card">
        <el-statistic v-loading="loading" :value="data.yesterdayTotal">
          <template #title>
            <div style="display: inline-flex; align-items: center">
              昨日发票金额
            </div>
          </template>
        </el-statistic>
      </div>
    </el-col>
  </el-row>
</template>

<script lang="ts" setup>
import { computed, onMounted, ref, unref } from 'vue'
import http from '@/support/http'
import { Code } from '@/enum/app'
import Message from '@/support/message'
const data = ref({
  todayNum:0,
  todayTotal:0,
  yesterdayTotal:0,
  yesterdayNum:0
})
const loading = ref(false)


onMounted(() => {
  // http
  //   .get('/bill/dashboard', unref({}))
  //   .then(r => {
  //     loading.value = true
  //     if (r.data.code === Code.SUCCESS) {
  //       data.value = r.data.data
  //     } else {
  //       Message.error(r.data.message)
  //     }
  //   })
  //   .finally(() => {
  //     loading.value = false
  //   })
})
</script>

<style scoped>
:global(h2#card-usage ~ .example .example-showcase) {
  background-color: var(--el-fill-color) !important;
}

.el-statistic {
  --el-statistic-content-font-size: 28px;
}

.statistic-card {
  height: 100%;
  padding: 20px;
  border-radius: 4px;
  background-color: var(--el-bg-color-overlay);
}

.statistic-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--el-text-color-regular);
  margin-top: 16px;
}

.statistic-footer .footer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.statistic-footer .footer-item span:last-child {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}

.green {
  color: var(--el-color-success);
}
.red {
  color: var(--el-color-error);
}
</style>
